<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<title></title>
<link rel="stylesheet" href="__CSS__/pintuer.css?v={$src_version}">
<link rel="stylesheet" href="__CSS__/admin.css?v={$src_version}">
<link rel="stylesheet" href="__CSS__/responsive.css?v={$src_version}">
<script src="__JS__/jquery-3.2.1.min.js?v={$src_version}"></script>
<script src="__JS__/pintuer.js?v={$src_version}"></script>
<script src="__JS__/jquery.nicescroll.js"></script>
<script src="__PUBLIC__/layer.js?v={$src_version}"></script>
<script src="__JS__/ming.js?v={$src_version}"></script>
<script src="__JS__/responsive.js?v={$src_version}"></script>
</head>
<body>
	<div class="panel admin-panel">
		<div  class="padding">
			<form action="" name="form" method="POST" class="search-form" >
				<input type="text" name="id" id="id" value="" style="display: none;" />
				<ul class="search">
					<li><input type="text" name="sort_name" id="sort" placeholder="请输入商品分类"  class="input" ></li>
					<li><input type="submit" id="submit" value="搜索" class="button border-main icon-search" style="padding: 10px 15px;"></li>
				</ul>
			</form>
		</div>
		<!-- <a  class="button border-yellow" onclick="outad()" style="display:block;width:80px;padding:3px 5px; "><span class="icon-plus-square-o"></span>添加分类</a> -->
		<a  class="button border-yellow class-add"  style="display:block;width:80px;padding:3px 5px; "><span class="icon-plus-square-o"></span>添加分类</a>
		<table class="table table-hover text-center">
			<tr>
				<th>序号</th>
				<th>分类名称</th>
				<th>操作</th>
			</tr>
			<volist name="list" id="vo">
				<tr>
					<td>{$i}</td>
					<td>{$vo.sort_name}</td>
					<td>
						<div class="button-group">
							<a class="button border-main edit"  data-id="{$vo.id}" data-name="{$vo.sort_name}" data-action="{:U(\'Sort/edit\')}" data-btn="确认修改">
							<span class="icon-edit"></span>修改</a> 
							<a class="button border-red del" data-id="{$vo.id}" data-name="{$vo.sort_name}" data-action="{:U(\'Sort/del\')}" data-btn="确认删除">
							<span class="icon-trash-o"></span>删除</a></td>
						</div>
				</tr>
			</volist>
		</table>
		<div  id="out" style="display: none;padding: 10px">
			<form class="layer-form" id="more-form" action="" name="action" method="POST">
				<input type="text" name="id" id="class-id" value="" style="display: none;" />
				<div class="layer-form-item">
					<label class="layer-form-label">商品分类名称：</label>
					<div class="layer-input-inline">
						<input class="layer-input" type="text" name="sort_name" id="class-sort" value="" />
					</div>
				</div>
				<div class="layer-form-item">
					<div class="layer-input-block">
						<input class="layer-btn" type="submit" id="class-submit" value="" />
					</div>
				</div>
			</form>
		</div>
	</div>
</body>
<script>
$('.class-add').click(function(){
	$('#more-form').attr('action',"{:U('Sort/add')}");
	$('#class-submit').val('确认添加');
	layer.open({
		title:'分类添加',
		type: 1,
		content: $('#out'),
	});
})
$('.edit').click(function(){
	var id=$(this).attr('data-id'),name=$(this).attr('data-name'),btn=$(this).attr('data-btn');
	$('#class-id').val(id);
	$('#class-sort').val(name);
	$('#more-form').attr('action',$(this).attr('data-action'));
	$('#class-submit').val(btn);
	layer.open({
		title:'分类修改',
		type: 1,
		content: $('#out'),
	});
})
$('.del').click(function(){
	$('#class-id').val($(this).attr('data-id'));
	$('#class-sort').val($(this).attr('data-name')).attr('readonly','readonly');
	$('.layer-form-item').attr('display','none');
	$('#more-form').attr('action',$(this).attr('data-action'));
	$('#class-submit').val($(this).attr('data-btn'));
	layer.open({
		title:'删除',
		type: 1,
		content: $('#out'),
	});
})

</script>
</html>